#include "pub_defs.h"
#include <iostream>

int main() {
    uint8_t* arr = new uint8_t[(M+2)*(N+2)];
    uint8_t* ans_arr = new uint8_t[(M+2)*(N+2)];

    // debug print
    read_binfile(arr, (M+2)*(N+2), "input.bin");

    double start_time = wall_time();
    gameoflife_baseline(arr);
    double last_time = wall_time() - start_time;
    std::cout << "Time taken: " << last_time << " seconds" << std::endl;
    
    read_binfile(ans_arr, (M+2)*(N+2), "output.bin");

    if (!compare_array(arr, ans_arr, (M+2)*(N+2))){
        std::cerr << "Error: output is not correct!" << std::endl;
        delete[] arr;
        delete[] ans_arr;
        return 1;
    }
    std::cout << "Output is correct!" << std::endl;

    delete[] arr;
    delete[] ans_arr;
    return 0;
}